package com.ryskoo.basicdata.weixin.service;

import com.ryskoo.basicdata.weixin.domain.WeixinParamPO;
import com.ryskoo.basicdata.weixin.repository.IWeixinParamRepository;
import com.ryskoo.framework.core.service.BasicServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @author HH
 */
@Service
public class WeixinParamServiceImpl extends BasicServiceImpl<WeixinParamPO> implements IWeixinParamService {
   
	@Autowired
    private IWeixinParamRepository weixinParamRepository;

    @PostConstruct
    public void init() {
        this.setDao(weixinParamRepository);
    }

    /**
     * 通过商户id获取商户微信配置
     *
     * @param vendorId 商户id
     * @return 商户微信配置
     */
    @Override
    public WeixinParamPO getByVendorId(String vendorId) {
        return weixinParamRepository.getByVendorId(vendorId);
    }

    /**
     * 通过微信支付商户号获取商户微信配置
     *
     * @param payMchid 微信支付商户号
     * @return 商户微信配置
     */
    @Override
    public WeixinParamPO getByMchId(String payMchid) {
        return weixinParamRepository.getByMchId(payMchid);
    }
}
